package org.wu.framework.authorization.platform.infrastructure.converter;

import org.wu.framework.authorization.platform.infrastructure.entity.SysRoleDO;
import org.wu.framework.authorization.platform.domain.model.sys.role.SysRole;
import org.wu.framework.lazy.orm.core.persistence.reverse.lazy.ddd.DefaultDDDLazyInfrastructureConverter;

/**
 * describe 角色
 *
 * @author Jia wei Wu
 * @date 2023/05/17 11:19 晚上
 * @see DefaultDDDLazyInfrastructureConverter
 **/

public class SysRoleConverter {


    /**
     * describe 实体对象 转换成领域对象
     *
     * @param
     * @return
     * @exception/throws
     * @author Jia wei Wu
     * @date 2023/05/17 11:19 晚上
     **/
    public static SysRole toRole(SysRoleDO sysRoleDO) {
        if (null != sysRoleDO) {
            SysRole sysRole = new SysRole();
            sysRole.setCode(sysRoleDO.getCode());
            sysRole.setCreateTime(sysRoleDO.getCreateTime());
            sysRole.setId(sysRoleDO.getId());
            sysRole.setIsDeleted(sysRoleDO.getIsDeleted());
            sysRole.setName(sysRoleDO.getName());
            sysRole.setStatus(sysRoleDO.isStatus());
            sysRole.setParentCode(sysRoleDO.getParentCode());
            sysRole.setUpdateTime(sysRoleDO.getUpdateTime());
            return sysRole;
        }
        return null;
    }

    /**
     * describe 领域对象 转换成实体对象
     *
     * @param
     * @return
     * @exception/throws
     * @author Jia wei Wu
     * @date 2023/05/17 11:19 晚上
     **/
    public static SysRoleDO fromRole(SysRole sysRole) {
        if (null != sysRole) {
            SysRoleDO sysRoleDO = new SysRoleDO();
            sysRoleDO.setCode(sysRole.getCode());
            sysRoleDO.setCreateTime(sysRole.getCreateTime());
            sysRoleDO.setId(sysRole.getId());
            sysRoleDO.setIsDeleted(sysRole.getIsDeleted());
            sysRoleDO.setStatus(sysRole.isStatus());
            sysRoleDO.setName(sysRole.getName());
            sysRoleDO.setParentCode(sysRole.getParentCode());
            sysRoleDO.setUpdateTime(sysRole.getUpdateTime());
            sysRoleDO.setZoneId(sysRole.getZoneId());
            return sysRoleDO;
        }
        return null;
    }

}